function login_user()
{
  Ext.QuickTips.init();
  var frmLogin = new Ext.form.Form({
            labelWidth: 70,
                method: "get",
            labelAlign: "right",
            baseParams: {action: "login"},
                 style:"height:100px",
                   url:"/sucri"
  });

    /*frmLogin.on("actionfailed", function(){
        //do something on action failed!
        Ext.MessageBox.alert("Error","There was timeout error. Contact your Administrator.");
    });*/

  frmLogin.add(
            new Ext.form.TextField({
                fieldLabel: 'User Name',
                      name: 'username',
                allowBlank:false,
                 msgTarget:'side'
            }),
            new Ext.form.TextField({
                fieldLabel: 'Password',
                      name: 'userpass',
                 inputType: 'password',
                allowBlank:false,
                 msgTarget:'side'
            })
        );

  frmLogin.applyIfToFields({ width:150 });

  frmLogin.addButton(('Login'), function(){
            if (frmLogin.isValid()) {
                frmLogin.submit({
                    params:{ },
                    waitMsg:'Logging in, please wait...',
                    success:function(form, action, o) {
                        window.location.replace("/sucri?action=userinfo");
                    },
                    failure:function(form, action) {
                        Ext.MessageBox.alert("Error",action.result.errorMessage);
                            frmLogin.reset();
                    }
                });
            }else{
                Ext.MessageBox.alert('Errors', 'Please fix the errors noted.');
            }
        }, frmLogin);


  var dlg = new Ext.BasicDialog("frmLogin", {
             autoCreate: true,
                  width: 330,
                 height: 190,
                  modal: true,
               closable: true,
              resizable: false,
              draggable: true,
            collapsible: false,
                  title:'Login'
        });

  frmLogin.render(dlg.body);
  dlg.on("show", function(){ frmLogin.items.item(0).focus(); });
  dlg.show();
};
//Ext.onReady(login_user());
